Skip to content

NCO-62: Fix TCP socket leaks via DI disposal cascade#57

Merged
davidkelly merged 1 commit into
masterfrom
dk/62
Apr 10, 2026
Merged

NCO-62: Fix TCP socket leaks via DI disposal cascade#57
davidkelly merged 1 commit into
masterfrom
dk/62

Conversation

@davidkelly
Copy link
Copy Markdown
Collaborator

Implemented a top-down IDisposable structure starting from Cluster that cascades through the internal dependency injection container. This guarantees all cached singletons and TCP sockets (via HttpHandler) are properly extinguished on shutdown.

  • Add IDisposable to Cluster, delegating to _serviceProvider.
  • Enforce IDisposable across all IServiceFactory instances.
  • Recursively dispose all singletons inside CouchbaseServiceProvider.
  • Expose explicit closure logic in CouchbaseHttpClientFactory.
  • Prevent memory leaks by exempting Transient instance tracking.
  • Add unit tests preventing future regressions.

Implemented a top-down IDisposable structure starting from Cluster
that cascades through the internal dependency injection container. This
guarantees all cached singletons and TCP sockets (via HttpHandler)
are properly extinguished on shutdown.

* Add IDisposable to Cluster, delegating to _serviceProvider.
* Enforce IDisposable across all IServiceFactory instances.
* Recursively dispose all singletons inside CouchbaseServiceProvider.
* Expose explicit closure logic in CouchbaseHttpClientFactory.
* Prevent memory leaks by exempting Transient instance tracking.
* Add unit tests preventing future regressions.
@davidkelly davidkelly marked this pull request as ready for review April 10, 2026 14:47
@davidkelly davidkelly merged commit 5be0c1f into master Apr 10, 2026
3 checks passed
@davidkelly davidkelly deleted the dk/62 branch April 10, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants